package com.cn.mmd.service;

import com.cn.mmd.mapper.EmploymentQuestMapper;
import com.cn.mmd.mapper.EmploymentQuestStatisticalMapper;
import com.cn.mmd.mapper.EmploymentQuestionnaireMapper;
import com.cn.mmd.model.EmploymentQuest;
import com.cn.mmd.model.EmploymentQuestStatistical;
import com.cn.mmd.model.EmploymentQuestionnaire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2016/8/27.
 */
@Service
public class EmploymentServiceImpl implements EmploymentService {

    @Autowired
    EmploymentQuestMapper employmentQuestMapper;
    @Autowired
    EmploymentQuestionnaireMapper employmentQuestionnaireMapper;
    @Autowired
    EmploymentQuestStatisticalMapper employmentQuestStatisticalMapper;


    /**
     * 添加就业问卷url表
     * @param employmentQuestionnaire
     * @return
     */
    public int insertEmploymentQuestionnaire(EmploymentQuestionnaire employmentQuestionnaire){
        return employmentQuestionnaireMapper.insertSelective(employmentQuestionnaire);
    }


    /**
     * 通过问卷id查询就业问卷url
     * @return
     */
    public EmploymentQuestionnaire selectEmploymentQuestionnaire(int questionnaireId){
        return employmentQuestionnaireMapper.selectByQuestionnaireId(questionnaireId);
    }

    /**
     * 设置就业问卷
     * @param employmentQuest
     * @return
     */
    public int insertEmploymentQuest(EmploymentQuest employmentQuest){
        return employmentQuestMapper.insertSelective(employmentQuest);
    }


    /**
     * 查看问卷
     * @param questionId
     * @return
     */
    public EmploymentQuest selectEmploymentQuest(int questionId){
        return employmentQuestMapper.selectByPrimaryKey(questionId);
    }

    /**
     * 查看全部统计结果
     * @return
     */
    public List<EmploymentQuestStatistical> selectStatisical(EmploymentQuestStatistical employmentQuestStatistical){
        return employmentQuestStatisticalMapper.selectStatistical(employmentQuestStatistical);
    }


    /**
     * 通过时间查看统计结果
     * @return
     */
    public  List<EmploymentQuestStatistical> selectNewStatisical(Map map){
        return employmentQuestStatisticalMapper.selectNewStatistical(map);
    }

    /**
     * 添加统计
     * @param employmentQuestStatistical
     * @return
     */
    public int insertEmploymentQuestStatistical(EmploymentQuestStatistical employmentQuestStatistical){
        return employmentQuestStatisticalMapper.insertSelective(employmentQuestStatistical);
    }


    /**
     * 查看最新统计结果
     * @return
     */
    public List<EmploymentQuestStatistical> selectLatestStatisical(){
        return employmentQuestStatisticalMapper.selectLatestStatisical();
    }
}
